﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="PhuKien_list.ascx.cs" Inherits="AdminPortal_Controls_SanPham_PhuKien_list" %>
<%@ Register src="../Toolbox.ascx" tagname="Toolbox" tagprefix="uc1" %>
<%@ Register src="../../../Controls/Common/Paging.ascx" tagname="Paging" tagprefix="uc3" %>
<script>
    $(function () {
        //mouseover line on gird
        $('#HNGdatagrid tbody >tr:not(:first)').mouseover(function () {
            $(this).css('background-color', '#fdf3eb');
        });
        $('#HNGdatagrid tbody >tr:not(:first)').mouseout(function () {
            $(this).css('background-color', '#fff');
        });

    });
    //change status
    function changeStatusPhuKien(imgName, cateID) {
        var urlUpdateStatus = '<%=Page.ResolveUrl("~/AdminPortal/Controls/SanPham/Ajax/PhuKien_UpdateStatus.ashx?id=") %>' + cateID;
        var img = $('#' + imgName);
        img.fadeOut();
        $.ajax({
            url: urlUpdateStatus,
            success: function (data) {
                if (data == 'true') {
                    img.attr('src', '<%=Page.ResolveUrl("~/AdminPortal/Images/Icon/tree_dnd_yes.png") %>');
                } else {
                    img.attr('src', '<%=Page.ResolveUrl("~/AdminPortal/Images/Icon/tree_dnd_no.png") %>');
                }
            }
        });
        img.fadeIn();
    }

</script>
<div style="padding-top:20px;">
Có: <asp:Label ID="lblTotalRecord" runat="server"></asp:Label> danh mục
</div>
<div id="HNGdatagrid">
    <div class="header-datagrid">
        <span class="icon-list header-text">Danh mục phụ kiện</span>
    </div>
    <div class="navibar-control">
        <div style="float:left;">
            <uc1:Toolbox ID="Toolbox1" runat="server" ShowAdd="true" OnAddClick="btnAdd_Click"
                                                      ShowDel="true" OnDelClick="btnDel_Click"
                                                      ShowSearch="true" OnSearchClick="btnSearch_Click"
                                                      ShowRefesh="true"  />
        </div>
        <div style="float:right;padding-right:10px;padding-top:10px;">
            Từ khoá: <asp:TextBox ID="txtKeySearch" runat="server" Width="250"></asp:TextBox>
        </div>
        <div class="clearB"></div>
    </div>
    <div class="content-datagrid">        
        <asp:GridView ID="dgvListPhuKien" runat="server" 
            AutoGenerateColumns="False" EnableModelValidation="True" GridLines="None" 
            onrowdatabound="dgvListPhuKien_RowDataBound" 
            onrowcommand="dgvListPhuKien_RowCommand" >
            <Columns>
                 <asp:TemplateField HeaderText="#" ItemStyle-CssClass="ItemColumnCenter" HeaderStyle-Width="30">
                    <ItemTemplate>
                        <%# Container.DataItemIndex + 1 %>
                    </ItemTemplate>
                </asp:TemplateField>

                <asp:TemplateField ItemStyle-CssClass="ItemColumnCenter" HeaderStyle-Width="30" >
                    <HeaderTemplate>                    
                        <input id="chkAll" type="checkbox" name="chkAll" onclick="javascript:SelectAllCheckboxes(this);"/>
                    </HeaderTemplate>
                    <ItemTemplate>
                        <input id="chkID" type='checkbox' runat='server' name='chkID'  value='<%# Eval("ID") %>' />
                    </ItemTemplate>
                </asp:TemplateField>

                <asp:TemplateField HeaderText="Tên Phụ kiện">
                    <ItemTemplate>
                        <asp:HyperLink ID="lnkPhuKien" runat="server" Text="Tên Phụ kiện"></asp:HyperLink>
                    </ItemTemplate>
                </asp:TemplateField>

                <asp:TemplateField HeaderText="Sản phẩm">
                    <ItemTemplate>
                        <asp:LinkButton ID="btnSanPham" runat="server"
                                                CommandName="ListSanPham"
                                                CommandArgument='<%# Eval("SanPhamID") %>'
                                                Text='<%# Eval("TenSanPham") %>'></asp:LinkButton>
                    </ItemTemplate>
                </asp:TemplateField>

                <asp:TemplateField HeaderText="Trạng Thái" ItemStyle-CssClass="ItemColumnCenter" HeaderStyle-Width="70">
                    <ItemTemplate>
                        <asp:Label ID="lblGiaBan" runat="server"></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>

                 <asp:CheckBoxField DataField="SuDungGia" HeaderText="Sử dụng giá" ItemStyle-CssClass="ItemColumnCenter" HeaderStyle-Width="30" />

                <asp:TemplateField HeaderText="Trạng Thái" ItemStyle-CssClass="ItemColumnCenter" HeaderStyle-Width="70">
                    <ItemTemplate>
                        <asp:Image ID="imgUpdate" runat="server" style="cursor:pointer;"/>
                    </ItemTemplate>
                </asp:TemplateField>

            </Columns>
        </asp:GridView>
    </div>
</div>
<div class="pagingCss">
    <asp:DropDownList ID="ddlPageSize" runat="server" AutoPostBack="True" 
        onselectedindexchanged="ddlPageSize_SelectedIndexChanged">
    </asp:DropDownList>
    <uc3:Paging ID="Paging1" runat="server"  OnPageIndexChanged="Paging1_OnPageIndexChanged"/>
</div>